{% extends "base.html" %} 
{% block headtitle %}kindly.cz - Účet{% endblock %}
{% block head %}        
    <script type="text/javascript" src="/js/jquery.form.min.js"></script>
	
	<script type="text/javascript">
		function jqload() {
			// validation and ajax POST on subscription form			
			new setupSubscribeForm();
			 
			// select reader type	
			$('#reader_type').attr('value', '{{user_settings.reader_type}}')
			
			// make the labels same height as form elms
			$("label.grid_3 + div > textarea,select,input[type=text]")
				.parent().prev() // get back to label
				.each(function(index) {h = $(this).next().children().first().outerHeight();$(this).height(h)})
				// below does not work, hence the fn up				
				//.height($(this).next().children().first().outerHeight())
				
			// form tooltips	
			$("input[type=text], input[type=checkbox], textarea").tipsy({gravity: 'w'})		
			$("label.grid_3[title]").tipsy({gravity: 'w'})		
			
			// all day
			$("input.everyday").click(function() {
  				//alert(this.name);				
				$(this).parent().children().attr('checked', $(this).is(':checked'))
			});
		}		
	</script> 	   
{% endblock %}

{% block content %} 

<form id="ajaxForm" method="post" action="account">

<div class="grid_9 alpha omega">
	<h1 class="sectionHeading" style="background-image: url('/images/People.png')">Váš účet</h1>
</div>

<!-- warning -->
<p><strong>Důležité:</strong> Pokud jste to ještě neudělali, změňte si ve svém <a href="https://www.amazon.com/myk">Amazon Kindle účtu</a> v sekci <em>Your Kindle Approved E-mail List</em> povolenou emailovou adresu na <em>@kindly.cz</em> (dříve to bylo subscriptions@kindly.cz)!</p>
	
<!-- Account info -->
<label id="laccount" class="grid_3 alpha corner-left"><span>Váš účet</span></label>	
<div class="grid_6 omega">{% render_user_link current_uri %}</div>
<div class="clear"></div>

<!-- Reader type -->
<label id="lreader_type" for="reader_type" class="grid_3 alpha corner-left"><span>Vaše čtečka</span></label>
<div class="grid_6 omega">
<select name="reader_type" id="reader_type">
	<option value="">Vyberte</option>
	<option value="Kindle4">Kindle</option>
	<option value="KindleFire">Kindle Fire</option>
	<option value="Kindle4T">Kindle Touch</option>
	<option value="Kindle4T3G">Kindle Touch 3G</option>	
	<option value="Kindle3W">Kindle 3 WiFi</option>
	<option value="Kindle3W3G">Kindle 3 WiFi+3G</option>
	<option value="KindleDX">Kindle DX</option>
	<option value="KindleDXg">Kindle DX Graphite</option>
	<option value="Kindle2">Kindle 2</option>
	<option value="Kindle1">Kindle 1</option>
	<option value="Other">Jiné</option>
</select>
</div>
<div class="clear"></div> 

<!-- Subscription address -->
<label id="lemail" for="email" class="grid_3 alpha corner-left"><span>Doručovací email</span></label>
<div class="grid_6 omega">
	<input name="email" id="email" type="text" value="{{user_settings.email}}" title="Na tuto adresu budou odesílány níže uvedené RSS feedy">
</div>
<div class="clear"></div> 

<div class="grid_9 alpha omega">
	<h1 class="sectionHeading" style="background-image: url('/images/Calendar.png')">Nastavení zasílání</h1>
</div>

<!-- Periodicals subscription -->
<div class="grid_6 prefix_3">
	<span class="grid_sch">Po</span>
	<span class="grid_sch">Út</span>
	<span class="grid_sch">St</span>
	<span class="grid_sch">Čt</span>
	<span class="grid_sch">Pá</span>
	<span class="grid_sch">So</span>
	<span class="grid_sch">Ne</span>
	<span class="grid_sch">Denně</span>
</div>
<div class="clear"></div>	
	
{% for subscription in subscriptions %}
<label class="grid_3 alpha corner-left" {% if subscription.send_next %}title="Odeslání naplánováno na {{subscription.send_next}}"{% endif %} ><span>{{subscription.link}}</span></label>	
<div class="grid_6 omega">
<input {% if subscription.schedule_0 %}checked{% endif %} type="checkbox" value="0" name="check_{{subscription.keyname}}" class="grid_sch" title="Pondělí v 7:00">	
<input {% if subscription.schedule_1 %}checked{% endif %} type="checkbox" value="1" name="check_{{subscription.keyname}}" class="grid_sch" title="Úterý v 7:00">	
<input {% if subscription.schedule_2 %}checked{% endif %} type="checkbox" value="2" name="check_{{subscription.keyname}}" class="grid_sch" title="Středa v 7:00">	
<input {% if subscription.schedule_3 %}checked{% endif %} type="checkbox" value="3" name="check_{{subscription.keyname}}" class="grid_sch" title="Čtvrtek v 7:00">	
<input {% if subscription.schedule_4 %}checked{% endif %} type="checkbox" value="4" name="check_{{subscription.keyname}}" class="grid_sch" title="Pátek v 7:00">	
<input {% if subscription.schedule_5 %}checked{% endif %} type="checkbox" value="5" name="check_{{subscription.keyname}}" class="grid_sch" title="Sobota v 7:00">	
<input {% if subscription.schedule_6 %}checked{% endif %} type="checkbox" value="6" name="check_{{subscription.keyname}}" class="grid_sch" title="Neděle v 7:00">
<input type="checkbox" name="{{subscription.keyname}}" class="grid_sch everyday" title="Každý den v 7:00">
</div>
<div class="clear"></div>
{% endfor %}

<!-- Note -->
<label id="lnote" class="grid_3 alpha corner-left"><span>Poznámka</span></label>	
<div class="grid_6 omega">
	<textarea name="note" rows=5 title="Chcete-li, zanechte nám vzkaz, Třeba odkaz na Vaše oblíbené stránky, které byste tady rádi viděli.">{{user_settings.note}}</textarea>
</div>
<!-- Submit -->
<div class="grid_6 prefix_3 alpha omega">
	<input type="submit" value="Uložit">	
</div>	
<div class="clear"></div> 

<!-- Submit message -->
<div class="grid_9 alpha omega">
	<h1 id="ajaxForm-message" class="sectionHeading"></h1>	
</div>

</form>

{% endblock %}

{% block sidebar %} 

<div class="grid_3 omega sidebar">	
	<div class="sidebar_header" style="background-image: url('/images/Mail16.png')">
		Naposledy odeslané
	</div> 
	<table class="report">		
		{% for item in log %}	
		<tr>		
			<td>{{item.name}}</td>
			<td>{{item.dt}}</td>				
		</tr>
		{% endfor %}
	</table>	
</div>

{% endblock %}

